﻿@inherits System.Web.Mvc.WebViewPage<MVCSample.UI.Models.WebSearchModel>

<h2>@Model.Title</h2>
Search text: <input type="text" id="SearchText" />
Start with: <input type="text" id="StartWith" />
<a href="#" id="Search" style="text-decoration:none"><img src='@Url.Content("~/Content/Images/Search.jpg")' width="30px" height="20px" border="0">Search</img></a>

<table>
<tr style="background-color:#0000FF; color: #fff	">
	<td>Title</td>
	<td>Content</td>
</tr>

@foreach(var web in Model.ListOfWebs) {
	<tr>
		<td><a href="@web.Url">@Html.Encode(@web.TitleNoFormatting)</a></td>
		<td>@Html.Encode(@web.Content)</td>
	</tr>
}
</table>

<script language="javascript" type="text/javascript">
	var searchUrl = '@VirtualPathUtility.ToAbsolute("~/Home/Web")';

	$(document).ready(function () {
		$('#Search').click(function () {			
			var searchText = $('#SearchText').val();
			var startWith = $('#StartWith').val();

			var callAjax = new CallAjax(searchText, startWith, searchUrl);
			callAjax.search();			
		});
	});	
</script>